import request from '@/utils/request';

export const searchArticleApi = (data) => request.post('/article/search', data);

export const addArticleApi = (data) => request.post('/article/add', data);

// 条件分页查询所有分类
export const queryCategoryApi = (data) => request.post('/article/category/query', data);

// 条件分页查询所有标签
export const queryLabelApi = (data) => request.post('/article/label/query', data);

// 根据分类id列表获取标签信息
export const getCategoryByIdsApi = (data) => request.post('/article/category/queryByIds', data);

// 根据标签id列表获取标签信息
export const getLabelByIdsApi = (data) => request.post('/article/label/queryByIds', data);

// 点赞
export const likeArticleApi = (data) => request.post('/article/user/like', data);

// 收藏
export const starArticleApi = (data) => request.post('/article/user/star', data);

// 转发
export const shareArticleApi = (data) => request.post('/article/user/share', data);

// 获取热门分类
export const getHotCategoryApi = () => request.get('/article/category/queryHot');

// 获取热门话题
export const getHotLabelApi = () => request.get('/article/label/queryHot');

// 获取热门文章
export const getHotArticleApi = () => request.get('/article/queryHot');

// 发布评论
export const addCommentApi = (data) => request.post('/article/comment/add', data);

// 根据文章id查询所有评论
export const getCommentApi = (data) => request.post('/article/comment/query', data);

// 点赞评论
export const likeCommentApi = (data) => request.post('/article/comment/user/like', data);

// 根据当前登录用户查询发布的帖子
export const queryUserArticleApi = (data) => request.get(`/article/queryUserArticle/${data}`);

// 查询用户点赞的文章
export const getUserLikedApi = (data) => request.post('/article/user/getUserLiked', data);

// 查询用户收藏的文章
export const getUserStarApi = (data) => request.post('/article/user/getUserStar', data);

// 查询用户转发的文章
export const getUserShareApi = (data) => request.post('/article/user/getUserShared', data);

// 查询用户获赞数量
export const getUserLikeCountApi = (userId) => request.get(`/article/queryUserLike/${userId}`);

// 新增用户回复
export const addReplyApi = (data) => request.post('/article/reply/add', data);

// 根据评论id查询回复
export const getReplyApi = (data) => request.post('/article/reply/query', data);

// 点赞回复
export const likeReplyApi = (data) => request.post('/article/reply/user/like', data);
